def init_test_offer(session):
    from mall.models.member import Member
    from mall.models.product import Product
    from mall.models.offer import Offer
    session.query(Offer).delete()
    product_list = session.query(Product).all()

    member_list = session.query(Member).all()
    import random
    i = 0
    for p in product_list:

        for m in member_list:
            i += 1
            offer = Offer(
                id=i,
                product_id=p.id,
                dealer_id=m.id,
                count=random.randint(10, 100),
                slug='cdk',
                price=random.randint(2, 200),

            )
            session.add(offer)
    session.commit()
    for p in product_list:
        product_offer = session.query(Offer).filter(Offer.product_id == p.id).all()

        recommend_offer = random.choice(product_offer)

        recommend_offer.mask = 'R'
    session.commit()